package com.cipe.cmrs.util;

import java.util.Date;

public class TldUtil {

	
	public static String getDateSince(Date date){
		if(date == null){
			return "";
		}
		Date currentDate = DateUtil.getCurrentDate();
		int mints = (int)Math.ceil(DateUtil.getNumOfMintsBetweenDates(currentDate, date));
		
		if(mints >= (60*24*30)){
			
			int months = (int)Math.ceil(mints / (double)(60*24*30));
			if(months == 1){
				return "1 month";
			} else {
				return months + " months";
			}
			
		} else if(mints >= (60*24)){
			
			int days = (int)Math.ceil(mints / (double)(60*24));
			if(days == 1){
				return "1 day";
			} else {
				return days + " days";
			}
			
		} else if(mints >= 60){
			
			int hours = (int)Math.ceil(mints / (double)(60));
			if(hours == 1){
				return "1 hour";
			} else {
				return hours + " hours";
			}
			
		} else if(mints <= 1){
			return "1 mintu";
		} else {
			return mints + " minuts";
		}
	}

}
